package com.itheima;

import java.util.ArrayList;
import java.util.LinkedList;

/**
 *
 * demo：演示
 * LinkedList特点
 *无扩容思想
 *
 * LinkedList大驼峰
 * listName小驼峰
 */
public class LinkedListDemo {

    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();

        list.addFirst("张三");
        list.addLast("李四");
        list.addLast("王五");
        list.addLast("赵六");

        String s = list.get(3);//o（1）
        ArrayList<String> arrayList  = new ArrayList<>();

        String first = list.getFirst();
        System.out.println(first);
        String last = list.getLast();
        System.out.println(last);
        //removeFirst、removeLast返回的是删除的元素
        String removeFirst = list.removeFirst();
        System.out.println(removeFirst);
        String removeLast = list.removeLast();
        System.out.println(removeLast);

        System.out.println(list);

    }

}
